home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-08-16 | 4.1 KB | 161 lines | [TEXT/MPS ] |
- //========================================================================================
- //
- // File: Proxy.cpp
- // Release Version: $ ODF 1 $
- //
- // Author: M.Boetcher
- //
- // Copyright: (c) 1993 - 1996 by Apple Computer, Inc., all rights reserved.
- //
- //========================================================================================
-
- #include "Embed.hpp"
-
- // ----- Embed Part Includes -----
-
- #ifndef PROXY_H
- #include "Proxy.h"
- #endif
-
- #ifndef PART_H
- #include "Part.h"
- #endif
-
- #ifndef FRAME_H
- #include "Frame.h"
- #endif
-
- #ifndef DEFINES_K
- #include "Defines.k"
- #endif
-
- // ----- ODF Includes -----
-
- #ifndef FWFRMING_H
- #include "FWFrming.h"
- #endif
-
- #ifndef FWUTIL_H
- #include "FWUtil.h"
- #endif
-
- #ifndef FWPRESEN_H
- #include "FWPresen.h"
- #endif
-
- #ifndef FWFCTCLP_H
- #include "FWFctClp.h"
- #endif
-
- #ifndef FWODGEOM_H
- #include "FWODGeom.h"
- #endif
-
- #ifndef FWITERS_H
- #include "FWIters.h"
- #endif
-
- // ----- OpenDoc Includes -----
-
- #ifndef SOM_ODShape_xh
- #include <Shape.xh>
- #endif
-
- #ifndef SOM_ODTransform_xh
- #include <Trnsform.xh>
- #endif
-
- #ifndef SOM_ODSession_xh
- #include <ODSessn.xh>
- #endif
-
- //========================================================================================
- // RunTime Info
- //========================================================================================
-
- #ifdef FW_BUILD_MAC
- #pragma segment odfembed
- #endif
-
- //========================================================================================
- // class CEmbedProxy
- //========================================================================================
-
- //----------------------------------------------------------------------------------------
- // CEmbedProxy constructors
- //----------------------------------------------------------------------------------------
-
- CEmbedProxy::CEmbedProxy(Environment* ev, CEmbedPart* part, FW_CPresentation* presentation) :
- FW_MProxy(ev, part, presentation),
- fPart(part)
- {
- }
-
- //----------------------------------------------------------------------------------------
- // CEmbedProxy::~CEmbedProxy
- //----------------------------------------------------------------------------------------
-
- CEmbedProxy::~CEmbedProxy()
- {
- }
-
- //----------------------------------------------------------------------------------------
- // CEmbedProxy::UsedShapeChanged
- //----------------------------------------------------------------------------------------
- // Used shape of an embedded frame changed. Just invalidate and recalculate its clip
-
- void CEmbedProxy::UsedShapeChanged(Environment* ev,
- FW_CEmbeddingFrame* embeddingFrame,
- ODFrame* odEmbeddedFrame)
- {
- FW_UNUSED(odEmbeddedFrame);
-
- // ----- Recalculate the clip -----
- if (fPart->FacetNumber() == cOneFacet)
- {
- // ----- Use the standard facet clipper
- FW_CFacetClipper clipper(ev, fPart);
- clipper.Clip(ev, embeddingFrame);
- }
- else
- {
- // I cannot use the standard facet clipper because it only works for one facet
- // Because I know in which order the facets were created I can just iterates
- FW_CRect clipRects[4];
- ((CEmbedFrame*)embeddingFrame)->EmbeddedFacetBounds(ev, clipRects);
-
- FW_CFrameFacetIterator ite(ev, embeddingFrame);
- for (ODFacet* facet = ite.First(ev); ite.IsNotComplete(ev); facet = ite.Next(ev))
- {
- short n = 0;
- FW_CFacetIterator ite2(ev, facet);
- for (ODFacet* embeddedFacet = ite2.First(ev); ite2.IsNotComplete(ev); embeddedFacet = ite2.Next(ev))
- {
- FW_CAcquiredODShape aqClipShape = FW_NewODShape(ev, clipRects[n]);
- embeddedFacet->ChangeGeometry(ev, aqClipShape, NULL, NULL);
- n++;
- }
- }
- }
-
- embeddingFrame->Invalidate(ev);
- }
-
- //----------------------------------------------------------------------------------------
- // CEmbedProxy::FrameShapeRequested
- //----------------------------------------------------------------------------------------
- // We always want the embedded frame to have our frame shape
-
- ODShape* CEmbedProxy::FrameShapeRequested(Environment* ev,
- FW_CEmbeddingFrame* embeddingFrame,
- ODFrame* odEmbeddedFrame,
- ODShape* requestedFrameShape)
- {
- FW_UNUSED(requestedFrameShape);
- FW_UNUSED(odEmbeddedFrame);
-
- return ((CEmbedFrame*)embeddingFrame)->MakeFrameShape(ev); // No FW_CAcquiredODShape because we are returning it
- }
-
-
-